Example: Trace
Product: CODESYS Control
The example shows how to record and store values variables by means of the trace object in the device tree and the Trace visualization element.
![]() |
![]() |
Description
Application: TraceRecordingExample
The application shows how to record and store values of variables by means of the trace object in the device tree and the Trace visualization element. To do this, the application has to be download to the controller and started.
Steps to store and load recordings by means of the Trace visualization element:
In the visualization, adapt the paths for Store trace and Load trace if necessary.
Note: Absolute paths are not allowed.
Click the Start Trace button to start the trace.
Click the Start recording trigger button to trigger the recording.
Click the Store trace button to store the trace.
Click the Load trace button to load the trace.
(Restriction: This only works if the trace has been stored with the currently running application.)
Steps to store and load recordings by means of the trace object in the device tree:
Configure whether or not the trace should be started by means of a menu command or a recording condition.
To do this, in the recording settings (Configuration), select or clear the Enable Trigger option.
Click Trace → Download to download the trace to the controller.
Click Trace → Start Trace to start the trace. If you have selected the Enable Trigger option, then the Start Trace menu command is disabled. Then the trace starts automatically after the download and is stopped by the trigger event. The Reset Trigger command restarts the trace.
Click Trace → Store Trace to store the trace.
Click Trace → Load Trace to load the trace.
Application: IECTraceConfiguration
The application uses structured text to directly configure a trace element. The corresponding functions of the trace manager are implemented in the CmpTraceMgr
library. Trace objects get their data from a package. A package can contain one or more records. The variable to be recorded is assigned to a record.
The PLC_PRG
program creates and configures a package and a corresponding record. The FBTracMgr
function block encapsulates the functions and handles of the CmpTraceMgr
trace manager.
The programmatically configured trace can be loaded into a trace object by means of the Trace → Upload Trace
command.
System requirements and restrictions
Programming system | CODESYS Development System (version 3.5.14.0 or higher) |
Runtime system | CODESYS Control Win (version 3.5.14.0 or higher) |
Add-on components | - |
Note
DOWNLOAD Project